--[[/**
-- * 
 * 提高伤害--敌方每有英雄死亡时
-- *
-- */]]

---@class BuffEffect263100 : BaseBuffEffect
BuffEffect263100 = ClientFight.CreateClass("BuffEffect263100", ClientFight.BaseBuffEffect)
local t = BuffEffect263100

---@param fight Fight
---@param buff FighterBuff
function t:action(fight, buff, ...)
    local parameters = {...};
    local source = buff.source;
    local fightResult = parameters[3];
    local oneRatio = buff.buffBean.f_BuffEffectValue[1];
    local maxRatio = buff.buffBean.f_BuffEffectValue[2];

    if (fightResult.damage <= 0) then
        return IBuffEffect.FAIL;
    end

    local dieAmount = 0;
    local fighters = fight.teams[3 - source.teamIndex].fighters;
    for k, fighter in pairs(fighters) do
        if (fighter:isSummons()) then
            goto continue;
        end
        if (fighter:isDie()) then
            dieAmount = dieAmount + 1;
        end
        :: continue ::
    end
    if (dieAmount <= 0) then
        return IBuffEffect.FAIL;
    end
    local calculateRatio = math.min(oneRatio * dieAmount, maxRatio) / 10000 + 1;
    fightResult.damage = (fightResult.damage * calculateRatio);

    return ClientFight.BaseBuffEffect.action(self, fight, buff, ...);
end

t.New()